
		<div id="view_user-dialog" style="display:none;" title="">	
				
				<table class="greentable">
					<tr>
						<td width="">Account #</td>
						<td><span id="rec-id"></span></td>
					</tr>
					<tr class="odd">
						<td>MT4 #</td>
						<td><span id="rec-mt4_uid"></span></td>
					</tr>
					<tr>
						<td>Agent #</td>
						<td><span id="rec-mt4_agent"></span></td>
					</tr>
					<tr class="odd">
						<td width="">Type</td>
						<td><span id="rec-type"></span></td>
					</tr>
					<tr>
						<td>Registered</td>
						<td><span id="rec-registered"></span></td>
					</tr>
					<tr>
						<td>Referral Name & account no.</td>
						<td><span id="rec-referral"></span></td>
					</tr>
					<tr class="odd">
						<td>IP Address</td>
						<td><span id="rec-user_ip"></span></td>
					</tr>
					<tr>
						<td>First Name</td>
						<td><span id="rec-firstname"></span></td>
					</tr>
					<tr class="odd">
						<td>Last Name</td>
						<td><span id="rec-lastname"></span></td>
					</tr>
					<tr>
						<td>Country</td>
						<td><span id="rec-country"></span></td>
					</tr>
					<tr class="odd">
						<td>E-mail</td>
						<td><span id="rec-email"></span></td>
					</tr>
					<tr>
						<td>Phone</td>
						<td><span id="rec-phone"></span></td>
					</tr>
					<tr class="odd">
						<td>Phone 2</td>
						<td><span id="rec-phone2"></span></td>
					</tr>
					<tr>
						<td>Address 1</td>
						<td><span id="rec-address1"></span></td>
					</tr>
					<tr class="odd">
						<td>Address 2</td>
						<td><span id="rec-address2"></span></td>
					</tr>
					<tr>
						<td>Country</td>
						<td><span id="rec-country"></span></td>
					</tr>
					<tr class="odd">
						<td>City</td>
						<td><span id="rec-city"></span></td>
					</tr>
					<tr>
						<td>State</td>
						<td><span id="rec-state"></span></td>
					</tr>
					<tr class="odd">
						<td>Zip Code</td>
						<td><span id="rec-zip"></span></td>
					</tr>
					<tr>
						<td>Citzenship</td>
						<td><span id="rec-citizenship"></span></td>
					</tr>
					<tr class="odd">
						<td>Passport ID</td>
						<td><span id="rec-passport_id"></span></td>
					</tr>
					<tr>
						<td>Date of birth</td>
						<td><span id="rec-dob"></span></td>
					</tr>
					<tr class="odd">
						<td>Business</td>
						<td><span id="rec-business"></span></td>
					</tr>
					<tr>
						<td>Exp. Securities</td>
						<td><span id="rec-exp_securities"></span></td>
					</tr>
					<tr class="odd">
						<td>Exp. Currencies</td>
						<td><span id="rec-exp_currencies"></span></td>
					</tr>
					<tr>
						<td>Exp. Futures</td>
						<td><span id="rec-exp_futures"></span></td>
					</tr>
					<tr class="odd">
						<td>Exp. Commodities</td>
						<td><span id="rec-exp_commodities"></span></td>
					</tr>
					<tr>
						<td>Exp. Forex</td>
						<td><span id="rec-exp_forex"></span></td>
					</tr>
					<tr class="odd">
						<td>Mirror Login ID</td>
						<td><span id="rec-mirror_login_id"></span></td>
					</tr>
					<tr>
						<td>MT4 Group</td>
						<td><span id="rec-mt4_group"></span></td>
					</tr>
					<tr class="odd">
						<td>Leverage</td>
						<td><span id="rec-leverage"></span></td>
					</tr>
					<tr>
						<td>Verified?</td>
						<td><span id="rec-verify"></span></td>
					</tr>
					<tr class="odd">
						<td>Balance</td>
						<td><span id="rec-balance"></span></td>
					</tr>
					<tr>
						<td>Free margin</td>
						<td><span id="rec-free_margin"></span></td>
					</tr>
					<tr class="odd">
						<td>Credit</td>
						<td><span id="rec-credit"></span></td>
					</tr>
					<tr>
						<td>Target number of customer per month</td>
						<td><span id="rec-customers_monthly"></span></td>
					</tr>
					<tr class="odd">
						<td>Present Total Accounts</td>
						<td><span id="rec-total_accts"></span></td>
					</tr>
					<tr>
						<td>Total Clients Funds</td>
						<td><span id="rec-total_clients_funds"></span></td>
					</tr>
					<tr class="odd">
						<td>Past Relationship with other Broker</td>
						<td><span id="rec-broker_relation"></span></td>
					</tr>
					<tr>
						<td>Countries clients are in</td>
						<td><span id="rec-clients_countries"></span></td>
					</tr>
					<tr class="odd">
						<td>Website</td>
						<td><span id="rec-website"></span></td>
					</tr>
					<tr>
						<td>Promotional material</td>
						<td><span id="rec-promo_material"></span></td>
					</tr>
					<tr class="odd">
						<td>Promotion methods</td>
						<td><span id="rec-promo_method"></span></td>
					</tr>
					<tr>
						<td>Other information</td>
						<td><span id="rec-other_info"></span></td>
					</tr>
				</table>
		</div>
		
		<div id="edit_user-dialog" style="display:none;" title="">	
				<form id="edit-form" action="" method="POST">
				<table class="greentable">
					<tr id="form-item_edit_id">
						<td width="">Account #</td>
						<td>
							<span id="edit-id"></span>
							<p class="error_descr"></p>
							<input type="hidden" id="edit_id" name="edit_id" value="" />
						</td>
					</tr>
					<tr id="form-item_edit_id">
						<td width="">Referral Name & account no.</td>
						<td><span id="edit_referral"></span></td>
					</tr>
					<tr>
						<td width="">Type</td>
						<td>
							<select id="edit_type" name="edit_type">
								<option value="real">Live</option>
								<option value="demo">Demo</option>
								<option value="aim">AIM</option>
							</select>
						</td>
					</tr>
					<tr>
						<td width="">Title</td>
						<td>
							<select id="edit_title" name="edit_title"></select>
						</td>
					</tr>
					<tr class="odd">
						<td>First Name</td>
						<td><input type="text" id="edit_firstname" name="edit_firstname" value="" /></td>
					</tr>
					<tr>

						<td>Last Name</td>
						<td><input type="text" id="edit_lastname" name="edit_lastname" value="" /></td>
					</tr>
					<tr class="odd">
						<td>Country</td>
						<td>
							<select id="edit_country" name="edit_country" style="">
									<option value="">Please choose...</option>
							</select>
						</td>
					<tr>
						<td>E-mail</td>
						<td><input type="text" id="edit_email" name="edit_email" value="" /></td>
					</tr>
					<tr id="form-item_pass">
						<td>Password</td>
						<td>
								<input type="password" id="edit_pass" name="edit_pass" value="" />
								<input type="text" id="edit_pass2" name="edit_pass2" value="" style="display:none;" />
								<input type="checkbox" id="edit-show-pass" value="yes" /> Show?
								<p class="error_descr"></p>
						</td>
					</tr>
					<tr>
						<td>Phone</td>
						<td><input type="text" id="edit_phone" name="edit_phone" value="" /></td>
					</tr>
					<tr>
						<td>Phone 2</td>
						<td><input type="text" id="edit_phone2" name="edit_phone2" value="" /></td>
					</tr>
					<tr>
						<td>Address 1</td>
						<td><input type="text" id="edit_address1" name="edit_address1" value="" /></td>
					</tr>
					<tr>
						<td>Address 2</td>
						<td><input type="text" id="edit_address2" name="edit_address2" value="" /></td>
					</tr>
					<tr>
						<td>City</td>
						<td><input type="text" id="edit_city" name="edit_city" value="" /></td>
					</tr>
					<tr>
						<td>State</td>
						<td><input type="text" id="edit_state" name="edit_state" value="" /></td>
					</tr>
					<tr>
						<td>Zip</td>
						<td><input type="text" id="edit_zip" name="edit_zip" value="" /></td>
					</tr>
					<tr>
						<td>Citzenship</td>
						<td>
							<select id="edit_citizenship" name="edit_citizenship" style="">
									<option value="">Please choose...</option>
							</select>
						</td>
					</tr>
					<tr>
						<td>Passport ID</td>
						<td><input type="text" id="edit_passport_id" name="edit_passport_id" value="" /></td>
					</tr>
					<tr>
						<td>Date of birth</td>
						<td>
								<select id="dob_day">
									<option value="">day...</option>
									<?php
										for($i=1;$i<=31;$i++)
										{
												echo  "\n\t\t\t<option value=\"".$i."\">".($i>=10?$i:'0'.$i)."</option>";
										}
									?>
								</select>
								<select id="dob_month">
									<option value="">month...</option>
									<?php
										$months = array('January','February','March','April','May','June','July','August','September','October','November','December');
										for($i=0;$i<count($months);$i++)
										{
												echo  "\n\t\t\t<option value=\"".($i+1)."\">".$months[$i]."</option>";
										}
									?>
								</select>
								<select id="dob_year">
										<option value="">year...</option>
										<?php
											for($i=date("Y")-18;$i>date("Y")-100;$i--)
											{
													echo  "\n\t\t\t<option value=\"".$i."\">".$i."</option>";
											}
										?>
								</select>
						</td>
					</tr>
					<tr>
						<td>Business</td>
						<td><input type="text" id="edit_business" name="edit_business" value="" /></td>
					</tr>
					<tr>
						<td>MT4 #</td>
						<td><input type="text" id="edit_acct_id" name="edit_acct_id" value="" /></td>
					</tr>
					<tr>
						<td>Mirror login ID</td>
						<td><input type="text" id="edit_mirror_login_id" name="edit_mirror_login_id" value="" /></td>
					</tr>
					<tr>
						<td>Mirror account requested?</td>
						<td>
							<input type="radio" name="edit_mirror_request" value="yes" /> Yes
							<input type="radio" name="edit_mirror_request" value="no" /> No
						</td>
					</tr>
					<tr>
						<td>MT4 Group</td>
						<td><input type="text" id="edit_mt4_group" name="edit_mt4_group" value="" /></td>
					</tr>
					<tr>
						<td>MT4 Agent #</td>
						<td><input type="text" id="edit_agent_id" name="edit_agent_id" value="" /></td>
					</tr>
					<tr>
						<td>Leverage</td>
						<td><input type="text" id="edit_leverage" name="edit_leverage" value="" /></td>
					</tr>
					<tr>
						<td>Verify?</td>
						<td>
							<input type="radio" name="edit_verify" value="yes" /> Yes
							<input type="radio" name="edit_verify" value="no" /> No
						</td>
					</tr>
					<tr>
						<td>Web account Status</td>
						<td>
							<select id="edit_u_stat" name="edit_u_stat">
								<option value="active">Active</option>
								<option value="pending_partner">Pending partner</option>
								<option value="locked">Locked</option>
							</select>
						</td>
					</tr>
				</table>
				</form>
				
				<table class="greentable">
					<tr>
						<td>Stored doc</td> 
						<td>
							<iframe name="upload_doc" id="upload_doc" src="" style="display:none;"></iframe>
							<form id="doc-form" method="post" enctype="multipart/form-data" action="<?=$base_url?>admin/upload_doc/" target = "upload_doc">
								<input type="hidden" id="doc_user_id" name="doc_user_id" value="" />
								<input type="hidden" name="MAX_FILE_SIZE" value="20000000" />
								<input name="doc" id="doc" size="20" type="file" /> 
								<span id="doc-progress_icon"></span>
								<span id="doc-canvas"></span>
							</form>
						</td>
					</tr>
					<tr>
						<td>Signature image</td>
						<td>
							<iframe name="upload_sig" id="upload_sig" src="" style="display:none;"></iframe>
							<form id="sig-form" method="post" enctype="multipart/form-data" action="<?=$base_url?>admin/upload_sig/" target = "upload_sig">
								<input type="hidden" id="sig_user_id" name="sig_user_id" value="" />
								<input type="hidden" name="MAX_FILE_SIZE" value="30000000" />
								<input name="sig" id="sig" size="20" type="file" /> 
								<span id="sig-progress_icon"></span>
								<span id="sig-canvas"></span>
							</form>
						</td>
					</tr>
				</table>
				
				<table class="greentable">
					<tr>
						<td>Comment 1</td>
						<td><textarea rows="5" cols="60" id="edit_comment1" name="edit_comment1"></textarea></td>
					</tr>
					<tr>
						<td>Comment 2</td>
						<td><textarea rows="7" cols="60"  id="edit_comment2" name="edit_comment2"></textarea></td>
					</tr>
					<tr>
						<td>Comment 3</td>
						<td><textarea rows="7" cols="60"  id="edit_comment3" name="edit_comment3"></textarea></td>
					</tr>
				</table>
				
				<div style="align:center;">
				<form id="btn-form" action="" method="POST">
				<table cellspacing="0" cellpadding="4">
				<tr>
						<td>
							<span id="edit-stat" style="color:orange;font-weight:bold;display:none;"></span>
							<input type="submit" id="bt-save" value="Save changes" class="submit" />
						</td>
				</tr>
				</table>
				</form>
				</div>
		</div>
		<div id="dialog" title=""></div>



<script language="javascript">

		var search_query = '';
		var per_page	 = 50;
		var sort_by		 = 'id';
		var sort_order 	 = 'asc';
		var search_token = '';
		
		jQuery(document).ready(function(){
				jQuery('#search_form').bind('submit', function(){
					var sq = Cleanfield(jQuery('#search_query').val());
					if(sq!='' && sq.length<3)
					{
							alert('3 characters minimum required!');
							jQuery('#search_query').focus();
					}
					else
					{
						search_query = jQuery('#search_query').val();
						jxLoadUsers('1', true);
						return(false);
					}
				});
				
				jQuery('#ppg').bind('change', function(){
						per_page = jQuery(this).val();
				});
				
				// live search
				jQuery('#search_query').bind('keyup', function(){
						var q = jQuery.trim(jQuery(this).val());
						if(q.length>2) jxLoadUsers('1', false);
				});
				
				
		});
		
		function setFilter(sb, so) {
				sort_by 	= sb;
				sort_order 	= so;
				jxLoadUsers('1', true);
		}

		function jxLoadUsers(page, s) {
		
			if(s) jQuery.blockUI({ message: '<h3><img src="'+__base_url+'images/busy.gif" /> Loading...</h3>' });
		
			var postdata = "";
			search_query = jQuery('#search_query').val();
			postdata = postdata 	+ "page=" 			+ Cleanfield(page);
			postdata = postdata 	+ "&search_query=" 	+ Cleanfield(search_query);
			postdata = postdata 	+ "&per_page=" 		+ Cleanfield(per_page);
			postdata = postdata 	+ "&sort_by=" 		+ Cleanfield(sort_by);
			postdata = postdata 	+ "&sort_order=" 	+ Cleanfield(sort_order);
			postdata = postdata 	+ "&__csrf=" 		+ __csrf;
			postdata = postdata 	+ "&__ts=" 			+ __ts;
			
			jQuery.ajax({
					type: 'POST',
					url: __base_url+'admin/jx_load_users',
					data: postdata,
					cache:false,
					success: function(msg){
							// alert(msg);
							if(s) jQuery.unblockUI();
							
							try {
								var _obj = jQuery.parseJSON(msg);
								// alert(_obj.stat);
								if(typeof _obj.stat != 'undefined' && _obj.stat=='success' && typeof _obj.data != 'undefined')
								{
									jQuery('#search_results-container').html(_obj.data);
								}
							} catch(err) {
								// alert(msg);
							}
					},
					error: function(xhr,ajaxOptions,thrownError){
							alert(xhr.responseText);
					}
			});
		}
		
		function Cleanfield(value){			
			var value = encodeURIComponent(jQuery.trim(value));
			return value;
		}
		
</script>
		<script language="javascript">		
			var __locale = '<?php echo str_replace("'","\'",json_encode(array('select_choose'=>'Please choose...')));?>';
		</script>
		
		<script src="<?php echo $base_url; ?>js/validation.js"></script>
		<script src="<?php echo $base_url; ?>js/admin_mgt.js"></script>
		<script src="<?php echo $base_url; ?>js/userdata.js"></script>
		<script language="javascript">
				jQuery(document).ready(function() {
						jQuery('a.view, a.edit, a.del').click(function(event) {
								event.preventDefault();
						});
						jQuery('#bt-save').click(function(event){
								GolderMarkets.AdminMgt.SaveUserInfos();
						});
						jQuery('#edit-form').submit(function(){
								return GolderMarkets.AdminMgt.SaveUserInfos();
						});
						jQuery('#btn-form').submit(function(){
								return false;
						});
						jQuery('#edit-show-pass').click(function(){
								if(jQuery('#edit-show-pass').attr('checked'))
								{
									jQuery('#edit_pass').hide();
									jQuery('#edit_pass2').show();
								}
								else
								{
									jQuery('#edit_pass').show();
									jQuery('#edit_pass2').hide();
								}
						});
						jQuery('#edit_pass').keyup(function(){
								jQuery('#edit_pass2').val(jQuery(this).val());
						});
						jQuery('#edit_pass2').keyup(function(){
								jQuery('#edit_pass').val(jQuery(this).val());
						});
						var _hash = window.location.hash;
						var _pa   = /\#user-[0-9]+/i;
						if(_pa.test(_hash))
						{
							setFilter('id', 'desc')
						}
						
						GolderMarkets.UserData.Populate('en','title','edit_title','');
						GolderMarkets.UserData.Populate('en','country','edit_country','');
						GolderMarkets.UserData.Populate('en','country','edit_citizenship','');
				
				});
		</script>		
